/*
 * @Author: BuddyCoder
 * @Date: 2022-03-30 10:39:08
 * @LastEditTime: 2022-03-30 14:49:53
 * @LastEditors: BuddyCoder
 * @Description: 
 * @FilePath: /venom_log/src/wait.rs
 * MIT
 */

//use crate::WaitGroup;

use crate::WaitGroup;

/// In the case of multithreading, you need to call clone and drop at the end func
#[derive(Clone, Debug)]
pub struct VenomLogWaitGroup {
    pub inner: WaitGroup,
}

impl VenomLogWaitGroup {
    pub fn new() -> Self {
        Self {
            inner: WaitGroup::new(),
        }
    }
    /// wait call fast_log::exit();
    pub fn do_wait(self) {
        self.inner.wait();
    }
    /// wait call fast_log::exit();
    pub fn wait(self) {
        crate::venom_log::exit().unwrap();
        self.inner.wait();
    }
    ///send exit msg
    pub fn exit(self) {
        crate::venom_log::exit().unwrap();
    }
}